//
//  AppDelegate.swift
//  JGWB
//
//  Created by 付建国 on 2016/10/8.
//  Copyright © 2016年 sher. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    
    var defaultViewController : UIViewController?{
        let isLogin = PersonViewModel.shareIntance.isLogin
        return isLogin ? WelcomeController() : UIStoryboard.init(name: "Main", bundle: nil).instantiateInitialViewController()
        
    }
    
    
//    App Key：1180148814
//    App Secret：fed0843d7deb25087dacb2d8766330ba
//    授权回调页：http://www.jianshu.com/users/fc27f0ea5215/latest_articles
//    https://api.weibo.com/oauth2/authorize?client_id=1180148814&redirect_uri=http://www.jianshu.com/users/fc27f0ea5215/latest_articles

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        
        //设置全局tabbar颜色
         UITabBar.appearance().tintColor = UIColor.orange
        
        UINavigationBar.appearance().tintColor = UIColor.orange
        
        
        //创建window
        window = UIWindow.init(frame: UIScreen.main.bounds)
        window?.rootViewController = defaultViewController
        window?.makeKeyAndVisible()
 
        
        return true
    }

}

// MARK:- log的全局函数
func GOCOOLLog<T>(_ message : T, file : String = #file, funcName : String = #function, lineNum : Int = #line) -> Void {
    
    #if DEBUG//在build setting 中  swift flags  中加入标识
        
        let fileName = (file as NSString).lastPathComponent
        
        print("\(fileName)[\(funcName)](\(lineNum))-\(message)")
        
    #endif
    
}


